package com.example.shop_2210.adapter

import android.widget.ImageView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.example.base.entity.Menu
import com.example.shop_2210.R
import com.example.shop_2210.utils.GlideUtils

/**
 * 首页菜单适配器
 */
class MenuHomeAdapter:BaseQuickAdapter<Menu,BaseViewHolder>(R.layout.item_menu_home) {
    override fun convert(holder: BaseViewHolder, item: Menu) {
        val imageview = holder.getView<ImageView>(R.id.iv_menu)//获取控件
        GlideUtils.loadImage(context,item.pic,imageview)
        holder.setText(R.id.tv_menu,item.name)
    }
}